package org.idea.qiyu.threadpool.demo.asynchandle;

import org.springframework.boot.CommandLineRunner;
import org.springframework.context.ApplicationContext;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;

/**
 * @Author linhao
 * @Date created in 5:10 下午 2021/10/17
 */
@Component
public class AsyncHandlerConfig implements CommandLineRunner {

    @Resource
    private ApplicationContext applicationContext;

    @Override
    public void run(String... args) throws Exception {
//        AsyncHandlerService asyncHandlerService = (AsyncHandlerService) applicationContext.getBean("asyncSingleConsumerHandler");
        AsyncHandlerService asyncHandlerService = (AsyncHandlerService) applicationContext.getBean("asyncMultiConsumerHandlerHandler");
        asyncHandlerService.startJob();
        System.out.println("启动异步消费模型");
    }
}
